[MYSQL] select statement that combines similar rows with certain ids ?
Posted
by vegatron
on Stack Overflow
See other posts from Stack Overflow
or by vegatron
Published on 2010-04-16T19:02:19Z
Indexed on
2010/04/16
19:43 UTC
Read the original article
Hit count: 128
hi
I have a warehouse_products table which defines how many products in the warehouses
so lets say I have 20 records/rows in the table, some rows may contain the same product id but in a different warehouse
I need to create select statement that give every product one row, and in this row I must have the quantity in warehouse A and warehouse B ..
so in the end I will get for example 10 rows that contain all the data
id domain_id warehouse_id wh_product_id quantity
2 1 2 2 84
3 1 1 3 221
4 1 3 3 0
5 1 1 3 14
6 1 1 2 73
7 1 1 1 123
© Stack Overflow or respective owner